Skip to content
This repository was archived by the owner on Feb 20, 2023. It is now read-only.

Commit 98455c0

Browse files
AndiAJmergify[bot]
authored andcommitted
For #23816 fix disabled verifyMultipleLoginsSelectionsTest UI test
1 parent 1e03e27 commit 98455c0

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

app/src/androidTest/java/org/mozilla/fenix/ui/SettingsPrivacyTest.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import org.junit.Test
1818
import org.mozilla.fenix.customannotations.SmokeTest
1919
import org.mozilla.fenix.ext.settings
2020
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
21+
import org.mozilla.fenix.helpers.FeatureSettingsHelper
2122
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
22-
import org.mozilla.fenix.helpers.RetryTestRule
2323
import org.mozilla.fenix.helpers.TestAssetHelper
2424
import org.mozilla.fenix.helpers.TestHelper
2525
import org.mozilla.fenix.helpers.TestHelper.appContext
@@ -42,23 +42,20 @@ class SettingsPrivacyTest {
4242
private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
4343
private lateinit var mockWebServer: MockWebServer
4444
private val pageShortcutName = "TestShortcut"
45+
private val featureSettingsHelper = FeatureSettingsHelper()
4546

4647
@get:Rule
4748
val activityTestRule = HomeActivityIntentTestRule()
4849

49-
@Rule
50-
@JvmField
51-
val retryTestRule = RetryTestRule(3)
52-
5350
@Before
5451
fun setUp() {
5552
mockWebServer = MockWebServer().apply {
5653
dispatcher = AndroidAssetDispatcher()
5754
start()
5855
}
5956

60-
val settings = activityTestRule.activity.applicationContext.settings()
61-
settings.shouldShowJumpBackInCFR = false
57+
featureSettingsHelper.setJumpBackCFREnabled(false)
58+
featureSettingsHelper.disablePwaCFR(true)
6259

6360
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
6461
val autofillManager: AutofillManager =
@@ -301,7 +298,6 @@ class SettingsPrivacyTest {
301298
}
302299
}
303300

304-
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/23816")
305301
@SmokeTest
306302
@Test
307303
fun verifyMultipleLoginsSelectionsTest() {

app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,25 @@ class BrowserRobot {
631631
}
632632

633633
fun verifyPrefilledLoginCredentials(userName: String) {
634+
var currentTries = 0
635+
// Sometimes the assertion of the pre-filled logins fails so we are re-trying after refreshing the page
636+
while (currentTries++ < 3) {
637+
try {
638+
mDevice.waitForObjects(userNameTextBox)
639+
assertTrue(userNameTextBox.text.equals(userName))
640+
641+
break
642+
} catch (e: AssertionError) {
643+
browserScreen {
644+
}.openThreeDotMenu {
645+
}.refreshPage {
646+
clearUserNameLoginCredential()
647+
clickSuggestedLoginsButton()
648+
verifySuggestedUserName(userName)
649+
clickLoginSuggestion(userName)
650+
}
651+
}
652+
}
634653
mDevice.waitForObjects(userNameTextBox)
635654
assertTrue(userNameTextBox.text.equals(userName))
636655
}

0 commit comments

Comments
 (0)